Component({
  data: {
    selected: 0,
    selectedColor: "#7468BE",
    allList:[{
      list1: [
        {
          "pagePath": "/pages/logs/logs",
          "iconPath": "/resources/images/home.png",
          "selectedIconPath": "/resources/images/selected_home.png",
          "text": "主页"
        },
        {
          "pagePath": "/pages/class/class",
          "iconPath": "/resources/images/class.png",
          "selectedIconPath": "/resources/images/selected_class.png",
          "text": "班级"
        },
        {
          "pagePath": "/pages/signature/signature",
          "iconPath": "/resources/images/OnlineArtboards.png",
          "selectedIconPath": "/resources/images/selected_OnlineArtboards.png",
          "text": "画板"
        },
        {
          "pagePath": "/pages/video/video",
          "iconPath": "/resources/images/video.png",
          "selectedIconPath": "/resources/images/selected_video.png",
          "text": "视频"
        },
        {
          "pagePath":"/pages/center/center",
          "iconPath": "/resources/images/personCenter.png",
          "selectedIconPath": "/resources/images/selected_personCenter.png",
          "text": "我的"
        }
      ],
      list2: [
      {
        "pagePath": "/pages/class/class",
        "iconPath": "/resources/images/class.png",
        "selectedIconPath": "/resources/images/selected_class.png",
        "text": "班级"
      },
      {
        "pagePath": "/pages/signature/signature",
        "iconPath": "/resources/images/OnlineArtboards.png",
        "selectedIconPath": "/resources/images/selected_OnlineArtboards.png",
        "text": "画板"
      },
      {
        "pagePath": "/pages/video/video",
        "iconPath": "/resources/images/video.png",
        "selectedIconPath": "/resources/images/selected_video.png",
        "text": "视频"
      },
      {
        "pagePath":"/pages/center/center",
        "iconPath": "/resources/images/personCenter.png",
        "selectedIconPath": "/resources/images/selected_personCenter.png",
        "text": "我的"
      }]
    }],
    list:[], 
    
  },
  attached() {
    const roleId = wx.getStorageSync('role')
    console.log(roleId)
    if (roleId == '学生') {
      this.setData({
        list: this.data.allList[0].list1
      })
    }else if(roleId=='教师'){
      this.setData({
        list: this.data.allList[0].list2
      })
    }
  },
  methods: {
    switchTab(e) {
      console.log(e)
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  }
})